/*
 * Copyright 2004-2005 公司名
 * 本软件及其所有拷贝的名称，与光盘上或本软件中注明的公司同在。
 * 本软件及文档享有版权，并受国家版权法及国际协约条款的保护。
 * 您不可以从本软件中去掉其版权声明；并保证为本软件的拷贝（本部或部分）* 复制版权声明。
 * 您同意制止以任何形式非法拷贝本软件及文档。
 * 版权信息参见：
 *      http://www.companyname.cn/licenses
 */

package com.companyname.common.base.web.service;

import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.Vector;
import java.util.Set;
import java.util.LinkedHashSet;

import javax.servlet.http.*;

import org.apache.log4j.Logger;

import com.companyname.common.base.model.BaseObject;
import com.companyname.common.base.manager.Manager;

import com.companyname.common.logs.util.CompanyNameLogsException;

import org.springframework.orm.ObjectRetrievalFailureException;

/**
 * 修改实体pri，供排序用
 *
 *  created by amon 2005-9-3 16:19
 */

public class ChangePriService extends TempletService
{
        static Logger logger = Logger.getLogger(ChangePriService.class);

        private Manager manager;

        public void setManager(Manager manager)
        {
                this.manager = manager;
        }

        /** 执行服务 */
        public void executeService(HttpServletRequest request)
        {
                logger.info("切换pri Service");
                BaseObject sbo = (BaseObject)request.getAttribute("sBO");
                this.iniUserInforIntoOldBO(request,sbo);
                BaseObject destbo = (BaseObject)request.getAttribute("destBO");
                this.iniUserInforIntoOldBO(request,destbo);
                this.manager.changePri(sbo,destbo);
        }

        /** 执行服务前（for 操作日志）*/
        public String getDetailBeforeExe(HttpServletRequest request)
        {
                BaseObject sbo = (BaseObject)request.getAttribute("sBO");
                BaseObject destbo = (BaseObject)request.getAttribute("destBO");
                StringBuffer sb = new StringBuffer(1000);
                sb.append("<old>").append(sbo.getModelDetailXML()).append(destbo.getModelDetailXML()).append("</old>");
                return sb.toString();
        }

        /** 执行服务后（for 操作日志）*/
        public String getDetailAfterExe(HttpServletRequest request)
        {
                BaseObject sbo = (BaseObject)request.getAttribute("sBO");
                BaseObject destbo = (BaseObject)request.getAttribute("destBO");
                StringBuffer sb = new StringBuffer(1000);
                sb.append("<new>").append(sbo.getModelDetailXML()).append(destbo.getModelDetailXML()).append("</new>");
                return sb.toString();
        }
}
